<?php
/**
 * AccountInfo
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Amazon Ads API - Profiles
 *
 * Profiles represent an advertiser and their account's marketplace, and are used in all subsequent API calls via a management scope, `Amazon-Advertising-API-Scope`. Reports and all entity management operations are associated with a single profile. Advertisers cannot have more than one profile for each marketplace.  Advertisers who operate in more than one marketplace (for example, Amazon.com, Amazon.co.uk, Amazon.co.jp) will have only one profile associated with each marketplace. [**See this link**](https://advertising.amazon.com/API/docs/en-us/info/api-overview#api-endpoints) for a list of marketplaces associated with each endpoint.  To retrieve your profile IDs, call the listProfiles operation, and include a valid authorization access token in the header. Use a `profileId` from the returned list as the value for the management scope (`Amazon-Advertising-API-Scope`) in the headers for subsequent API calls.
 *
 * OpenAPI spec version: 3.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * AccountInfo Class Doc Comment
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class AccountInfo implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'AccountInfo';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'marketplace_string_id' => 'string',
        'id' => 'string',
        'type' => '\AmazonAdvertisingApi\Model\AccountType',
        'name' => 'string',
        'sub_type' => 'string',
        'valid_payment_method' => 'bool'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'marketplace_string_id' => null,
        'id' => null,
        'type' => null,
        'name' => null,
        'sub_type' => null,
        'valid_payment_method' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'marketplace_string_id' => 'marketplaceStringId',
        'id' => 'id',
        'type' => 'type',
        'name' => 'name',
        'sub_type' => 'subType',
        'valid_payment_method' => 'validPaymentMethod'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'marketplace_string_id' => 'setMarketplaceStringId',
        'id' => 'setId',
        'type' => 'setType',
        'name' => 'setName',
        'sub_type' => 'setSubType',
        'valid_payment_method' => 'setValidPaymentMethod'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'marketplace_string_id' => 'getMarketplaceStringId',
        'id' => 'getId',
        'type' => 'getType',
        'name' => 'getName',
        'sub_type' => 'getSubType',
        'valid_payment_method' => 'getValidPaymentMethod'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }

    const SUB_TYPE_KDP_AUTHOR = 'KDP_AUTHOR';
    const SUB_TYPE_AMAZON_ATTRIBUTION = 'AMAZON_ATTRIBUTION';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getSubTypeAllowableValues()
    {
        return [
            self::SUB_TYPE_KDP_AUTHOR,
            self::SUB_TYPE_AMAZON_ATTRIBUTION,
        ];
    }

    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['marketplace_string_id'] = isset($data['marketplace_string_id']) ? $data['marketplace_string_id'] : null;
        $this->container['id'] = isset($data['id']) ? $data['id'] : null;
        $this->container['type'] = isset($data['type']) ? $data['type'] : null;
        $this->container['name'] = isset($data['name']) ? $data['name'] : null;
        $this->container['sub_type'] = isset($data['sub_type']) ? $data['sub_type'] : null;
        $this->container['valid_payment_method'] = isset($data['valid_payment_method']) ? $data['valid_payment_method'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        $allowedValues = $this->getSubTypeAllowableValues();
        if (!is_null($this->container['sub_type']) && !in_array($this->container['sub_type'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value for 'sub_type', must be one of '%s'",
                implode("', '", $allowedValues)
            );
        }

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets marketplace_string_id
     *
     * @return string
     */
    public function getMarketplaceStringId()
    {
        return $this->container['marketplace_string_id'];
    }

    /**
     * Sets marketplace_string_id
     *
     * @param string $marketplace_string_id The identifier of the marketplace to which the account is associated.
     *
     * @return $this
     */
    public function setMarketplaceStringId($marketplace_string_id)
    {
        $this->container['marketplace_string_id'] = $marketplace_string_id;

        return $this;
    }

    /**
     * Gets id
     *
     * @return string
     */
    public function getId()
    {
        return $this->container['id'];
    }

    /**
     * Sets id
     *
     * @param string $id Identifier for sellers and vendors. Note that this value is not unique and may be the same across marketplace.
     *
     * @return $this
     */
    public function setId($id)
    {
        $this->container['id'] = $id;

        return $this;
    }

    /**
     * Gets type
     *
     * @return \AmazonAdvertisingApi\Model\AccountType
     */
    public function getType()
    {
        return $this->container['type'];
    }

    /**
     * Sets type
     *
     * @param \AmazonAdvertisingApi\Model\AccountType $type type
     *
     * @return $this
     */
    public function setType($type)
    {
        $this->container['type'] = $type;

        return $this;
    }

    /**
     * Gets name
     *
     * @return string
     */
    public function getName()
    {
        return $this->container['name'];
    }

    /**
     * Sets name
     *
     * @param string $name Account name.
     *
     * @return $this
     */
    public function setName($name)
    {
        $this->container['name'] = $name;

        return $this;
    }

    /**
     * Gets sub_type
     *
     * @return string
     */
    public function getSubType()
    {
        return $this->container['sub_type'];
    }

    /**
     * Sets sub_type
     *
     * @param string $sub_type The account subtype.
     *
     * @return $this
     */
    public function setSubType($sub_type)
    {
        $allowedValues = $this->getSubTypeAllowableValues();
        if (!is_null($sub_type) && !in_array($sub_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'sub_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['sub_type'] = $sub_type;

        return $this;
    }

    /**
     * Gets valid_payment_method
     *
     * @return bool
     */
    public function getValidPaymentMethod()
    {
        return $this->container['valid_payment_method'];
    }

    /**
     * Sets valid_payment_method
     *
     * @param bool $valid_payment_method Only present for Vendors, this returns whether the Advertiser has set up a valid payment method or not.
     *
     * @return $this
     */
    public function setValidPaymentMethod($valid_payment_method)
    {
        $this->container['valid_payment_method'] = $valid_payment_method;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
